<!-- 自动删除 -->
<template>
  <div  class="dashboard-editor-container">
    <el-row style="background: #fff; padding: 16px 16px 0; margin-bottom: 32px">
      <div style="display:flex;justify-content:space-between;">
        <div class="title">设备配置日志自动处理配置</div>
        <div class="btn">
          <el-button type="primary" @click="submit()">保存设置</el-button>
        </div>
      </div>
      <div class="content">
        <div>
          <svg-icon icon-class="naozhong" />
        </div>
        <div class="certification">
          <el-form label-width="220px">
            <el-row :gutter="10">
              <el-col :xs="24" :sm="24" :lg="12">
                <el-form-item label="日志最大储存天数限制(天):">
                  <el-input v-model="autoForm.LogSaveDays"></el-input>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="6">
                <p class="c-p">填写为0表示不进行按日期自动删除动作</p>
              </el-col>
            </el-row>
            <el-row :gutter="10">
              <el-col :xs="24" :sm="24" :lg="12">
                <el-form-item label="自动数据处理时间点:">
                  <el-select  v-model="autoForm.AutoDelHours">
                    <el-option v-for="item in 24" :key="item" :label="item+':00'" :value="item"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="6">
                <p class="c-p">如果您的设备平常不断电，建议放到半夜进行日志自动删除</p>
              </el-col>
            </el-row>
          </el-form>
        </div>
      </div>
    </el-row>
  </div>
</template>

<script>
import { connrequest } from '@/api/firstPage'
export default {
data() {
  return {
    autoForm:{}
  }
},
//生命周期 - 创建完成（访问当前this实例）
  created() {
    this.getData()
  },
  //生命周期 - 挂载完成（访问DOM元素）
  mounted() {},
  methods:{
    async getData() {
      const res = await connrequest('GetParamLogCfg')
      this.autoForm = res.Data
    },
    async submit(){
      const data = {
        Data:{
          AutoDelHours: this.autoForm.AutoDelHours * 1,
          LogSaveDays: this.autoForm.LogSaveDays * 1
        }
      }
      const res = await connrequest('SetParamLogCfg', data)
      if(res.Status.StatusCode === 0){
        this.$message.success('自动删除参数保存成功')
        this.getData()
      }
    }
  }
}
</script>
<style lang="scss" scoped>
/* @import url(); 引入css类 */
.content {
  position: relative;
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  svg{
    font-size: 40px;
    margin-right: 20px;
  }
  ::v-deep .certification{
    .el-form-item__content{
      display: flex;
      align-items: flex-start;
    }
  }
  .c-p{
    width: 350px;
    color: #aaa;
    font-size: 12px;
    padding-left: 20px;
    white-space:nowrap;
  }
  .information{
    width: calc(100% - 70px);
  }
  .setUp{
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 30px;
    i{
      margin-right: 20px;
    }
    p{
      font-size: 14px;
      color: red;
    }
  }
  .btn{
    position: absolute;
    right: 50px;
    bottom: 20px;
  }
}

</style>